<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box1 {
      width: 600px;
      height: 400px;
      border: 2px solid lightcoral;
    }

    .box2 {
      width: 100px;
      height: 100px;
      background: lightpink;
      animation: run 10s linear infinite;
    }

    @keyframes run {
      25% {
        transform: translate(500px, 0);
        background-color: lightsalmon;
      }

      50% {
        transform: translate(500px, 300px);
        background-color: lightskyblue;
      }

      75% {
        transform: translate(0px, 300px);
        background-color: limegreen;
      }

      100% {
        transform: translate(0px, 0px);
        background-color: lemonchiffon;
      }
    }
  </style>
</head>

<body>
  <div class="box1">
    <div class="box2"></div>
  </div>
</body>

</html>